#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

//#include "../../../../core/shader_binding_ID.h"
//#include "../../../../core/shader_built_in_functions.h"
//#include "../../../../core/shader_ray.h"
#include "../../../../core/shader_std.h" 
#include "../../../../core/shader_mesh.h" 
//#include "../../../../core/shader_taster_color.h"

layout(binding = DEF_BINDING_ObMesh, scalar) readonly buffer B_ObMesh { S_ObMesh m_ObMesh[]; };


layout(location = 0) in vec4 vColor;
layout(location = 1) in vec3 vNormal;
layout(location = 2) in vec3 vLightPos[4];
layout(location = 9) in flat uint gMeshOffset;


layout(location=0) out vec4 outColor;
//layout(location=1) out vec4 outDepth;

//layout(early_fragment_tests) in;

void main(void){
	float d = (dot(vLightPos[0], vNormal)) + 1.0;
	//float PN = dot(vLightPos[0], vNormal);
	
	vec3 loc = abs(m_ObMesh[gMeshOffset].m_Location);

	uint wavelength = (gMeshOffset + 10) * 100;
	float r = float(wavelength >> 16) + 1;
    float g = float(wavelength >> 8) + 1;
    float b = float(wavelength & 0xFF) + 1;

	loc = vec3(r/255.0, g/255.0, b/255.0);

	outColor = vec4(normalize(loc), 1);
	outColor = vec4(1);
	//outColor = vec4(vColor.rgb, gl_FragCoord.z);
	//outColor = vec4(vec3(d, 0, gl_FragCoord.z), 1);
	//gl_FragDepth = gl_FragCoord.z;
	//outDepth = vec4(gl_FragCoord.z);
}



